package TestSchoolSubjects1;

import SchoolSubjects3.*;
import java.io.*;

public class TestSchoolSubjects2 { // 测试类2

    public static String toString(Students stu) {
        return "学生编号:" + " " + stu.getnumber() + " " + "学生姓名:" + " " + stu.getname() + " " + "性别:" + " "
                + stu.getsex() + " " + "所选课程:" + " " + stu.getCurriculums()[0].getcurriculumsname() + " "
                + stu.getCurriculums()[1].getcurriculumsname();
    }

    public static void main(String[] args) throws IOException, ClassNotFoundException { // 程序入口
        FileInputStream fileInputStream = new FileInputStream(
                "D:\\java\\Teachers_start_classes_and_students_choose_classes.dat");
        try (ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream)) {
            Teachers Mrwang = (Teachers) objectInputStream.readObject();
            Teachers MsLi = (Teachers) objectInputStream.readObject();
            Students StdWang = (Students) objectInputStream.readObject();
            Students StdZhang = (Students) objectInputStream.readObject();
            Students StdChen = (Students) objectInputStream.readObject();
            System.out.println("该学校开课老师有 " + Mrwang.getname() + "、" + MsLi.getname());
            StdWang.outCurriculums(StdWang, 2);
            System.out.println(toString(StdWang));
            System.out.println(toString(StdZhang));
            System.out.println(toString(StdChen));
        } catch (Exception e) {
            e.printStackTrace();
        }
        ;
    }
}